//
//  CommitTableView.m
//  EasyBuy
//
//  Created by Zhu Xiangjun on 10/15/12.
//  Copyright (c) 2012 shen donghao. All rights reserved.
//

#import "CommitTableView.h"
#import "CommitTableViewCell.h"

@implementation CommitTableView


-(id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style{
    self = [super initWithFrame:frame style:style];
    if(self){
        self.delegate = self;
        self.dataSource = self;
        self.showsHorizontalScrollIndicator  = NO;
        self.showsVerticalScrollIndicator = NO;
        self.backgroundColor = [UIColor clearColor];

    }
    return self;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    
    return 2;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"cellId";
    CommitTableViewCell *cell = [self dequeueReusableCellWithIdentifier:CellIdentifier];
    if (!cell) {
        cell = [[CommitTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    switch (indexPath.section) {
        case 0:
            
            cell.titleFiled.text = indexPath.row == 0 ? @"标题":@"描述";
            
            break;
        case 1:
            
            cell.titleFiled.text = indexPath.row == 0 ? @"价格":@"原价";
            
            break;
        case 2:
            
            cell.titleFiled.text = indexPath.row == 0 ? @"交易方式":@"运费";
            
            break;
        case 3:
            
            cell.titleFiled.text = indexPath.row == 0 ? @"分类":@"颜色";
            
            break;
        case 4:
            
            cell.titleFiled.text = indexPath.row == 0 ? @"位置":@"电话";
            
            break;

    }
    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 37;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)] autorelease];
    view.backgroundColor = [UIColor clearColor];
    return view;
}


@end
